package leetcode.code202;

public class Solution extends Solution202 {

	@Override
	public boolean isHappy(int n) {
		while (true) {
			int temp = 0;
			while (n > 0) {
				int l = n % 10;
				temp += l * l;
				n = n / 10;
			}
			if (temp == 4)
				return false;
			if (temp == 1)
				return true;
			n = temp;
		}
	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();

	}

}
